<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>

<fmt:setBundle basename="ApplicationMessage" />
<fmt:setLocale value="zh_CN" />

<%@ include file="/WEB-INF/include/meta.jsp"%>
<%@ include file="/WEB-INF/include/css.jsp"%>
<link href="${ctx.resource}/css/select2.css" rel="stylesheet">
<link href="${ctx.resource}/css/select2-bootstrap.css" rel="stylesheet">
<title>权限分配 - 租房宝金融管理平台</title>
</head>
<body>

	<%@ include file="/WEB-INF/include/header.jsp"%>

	<div class="web-g-main">
		<%@ include file="/WEB-INF/include/aside.jsp"%>
		<div class="content">
	      <header class="header clearfix">
	          <h3 class="pull-left">权限分配</h3>
	          <%-- <div class="btn-toolbar pull-right">
	            <div class="btn-group">
	                <a href="${ctx}/payment/waiting/search" class="btn btn-default btn-shadow btn-shadow-default demo2do-btn" data-target="#" data-toggle="modal" title="过滤查询"><i class="glyphicon glyphicon-search"></i>&nbsp;&nbsp;过滤查询</a>
	            </div>
	          </div> --%>
	       </header>
	       <ul class="nav nav-tabs color-tabs">
	         <li class="active"><a href="javascript:void(0)" class="unsettlement-tab" >权限分配</a></li>
	         <li><a href="${ctx}/create-user-role" class="settlement-tab">创建用户</a></li>
	         <li><a href="${ctx}/internal-user-role" class="settlement-tab">创建内部成员用户</a></li>
	       	<li><a href="${ctx}/show-user-list" class="settlement-tab">用户列表</a></li>
	       </ul>
	      <div class="table-area">
          <div class="btn-toolbar  pull-left">
			<div class="row" style="margin-top:10px;">
			<form class="form-horizontal col-sm-offset-1">
				<div class="form-group">
			         <div class="input-group col-sm-2">
			         	<span class="input-group-addon">商户</span>
			         	    <select name="app" class="form-control" required="required">
				              <option value=""></option>
				              <c:forEach var="item" items="${appList}">
				                <option value="${item.id }" <c:if test="${item.id eq app }">selected</c:if>>${item.name }</option>
				              </c:forEach>
				            </select>
			         </div>
			    </div>
	          	<div class="form-group">
			         <div class="input-group col-sm-2">
			         	<span class="input-group-addon">权限名称</span>
			         	    <select name="role" class="form-control" required="required">
				              <option value=""></option>
				              <c:forEach var="item" items="${userRoles}">
				                <option value="${item}">${item}</option>
				              </c:forEach>
				            </select>
			         </div>
	          	</div>
				<div class="form-group">
					<div class="input-group col-sm-offset-1">
					<button type="submit" class="btn btn-primary" id="submit"
						style="text-align: center;">确认修改</button>
					</div>
				</div>
			</form>
			</div>
			</div>
			</div>
			<%@ include file="/WEB-INF/include/footer.jsp"%>
		</div>
		</div>
		<%@ include file="/WEB-INF/include/script.jsp"%>
		<script src="${ctx.resource}/js/bootstrap-switch.min.js"></script>
		<script src="${ctx.resource}/js/bootstrap-modal-trigger.js"></script>
		<script src="${ctx.resource}/js/bootstrap.validate.js"></script>
		<script src="${ctx.resource}/js/bootstrap.validate.en.js"></script>
		<script src="${ctx.resource}/js/bootstrap-alert-fade-trigger.js"></script>
		<script type="text/javascript">
			$(document).ready(function() {
				$("#submit").click(function(event) {
					var app = $("select[name='app']").val();
					var role_name = $("select[name='role']").val();
					var error = false;
					if(app == "" || role_name ==""){
						error = true;
					}
					if (!error) {
						$.post('${ctx}/user-Authority-set', {
							app : app,
							role_name : role_name
						}, function(data) {
							alert(data);
						});
					}
					event.preventDefault();
					return false;
				});
			});
		</script>
</body>
</html>